home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / MacFormat 92 CD / Shareware Plus / Utilities / FolderSynchronizer 1.8.9 / FoldersSynchronizer / FoldersSynchronizer.9 / AllScripts_50_MultipleScroll.ls < prev    next >
Encoding:
Text File  |  2000-05-10  |  5.4 KB  |  186 lines

  1. on riga RecSelect
  2.   global gMaxMulti, gRowsMulti
  3.   if RecSelect > gRowsMulti then
  4.     return gRowsMulti
  5.   end if
  6.   if RecSelect < 1 then
  7.     return 1
  8.   end if
  9.   return ((RecSelect - 1) mod gRowsMulti) + 1
  10. end
  11.  
  12. on PagListaOfRec RecSelect
  13.   global gRowsMulti
  14.   if (RecSelect mod gRowsMulti) > 0 then
  15.     return (RecSelect / gRowsMulti) + 1
  16.   else
  17.     return RecSelect / gRowsMulti
  18.   end if
  19. end
  20.  
  21. on PosizioneRiga RecSelect
  22.   global interlineaLista
  23.   set magg to 1
  24.   if RecSelect < 1 then
  25.     return -1000
  26.   end if
  27.   return the locV of sprite 28 + (interlineaLista * (riga(RecSelect) - 1)) + magg
  28. end
  29.  
  30. on NextPrevious direzione
  31.   global gMaxMulti, gCurrMulti, interlineaLista, gRowsMulti, CurPage
  32.   if the mouseDown then
  33.     set xmouse to 1
  34.   end if
  35.   set CurRiga to riga(gCurrMulti)
  36.   set CurPage to PagListaOfRec(gCurrMulti)
  37.   if direzione = 1 then
  38.     set Minimo to 0
  39.     set Massimo to gMaxMulti
  40.   else
  41.     set Minimo to 1
  42.     set Massimo to gMaxMulti + 1
  43.   end if
  44.   if (gCurrMulti > Minimo) and (gCurrMulti < Massimo) then
  45.     RipetizioneTasto(direzione)
  46.   end if
  47.   repeat with i = 1 to 20000
  48.   end repeat
  49.   if xmouse then
  50.     repeat while the stillDown and (gCurrMulti > Minimo) and (gCurrMulti < Massimo)
  51.       RipetizioneTasto(direzione)
  52.     end repeat
  53.   else
  54.     repeat while ((the keyPressed = "") or (the keyPressed = "")) and (gCurrMulti > Minimo) and (gCurrMulti < Massimo)
  55.       RipetizioneTasto(direzione)
  56.     end repeat
  57.   end if
  58.   ImpostaControls()
  59. end
  60.  
  61. on RipetizioneTasto direzione
  62.   global gMaxMulti, gCurrMulti, CurPage, gRowsMulti, glineHeightMulti
  63.   set gCurrMulti to gCurrMulti + direzione
  64.   set the scrollTop of member "fOnOffMulti" to (gCurrMulti - 1) * glineHeightMulti
  65.   set the scrollTop of member "fSourceList" to (gCurrMulti - 1) * glineHeightMulti
  66.   set the scrollTop of member "fDestList" to (gCurrMulti - 1) * glineHeightMulti
  67.   updateStage()
  68. end
  69.  
  70. on FirstLast direzione
  71.   global gTable, gMaxMulti, gCurrMulti, interlineaLista, gRowsMulti, CurPage, VARListaRicette, VARListaEditabili, VARListaPreferite
  72.   if objectp(gTable) then
  73.     if gMaxMulti > 0 then
  74.       set CurRiga to riga(gCurrMulti)
  75.       set CurPage to PagListaOfRec(gCurrMulti)
  76.       if direzione = 1 then
  77.         mGoLast(gTable)
  78.       else
  79.         mGoFirst(gTable)
  80.       end if
  81.       set gCurrMulti to mGetPosition(gTable)
  82.       put gCurrMulti into field "fgCurrMulti"
  83.       if the frameLabel = "Lista" then
  84.         set the locV of sprite 27 to PosizioneRiga(gCurrMulti)
  85.         set NewCurPage to PagListaOfRec(gCurrMulti)
  86.         if CurPage <> NewCurPage then
  87.           set CurPage to NewCurPage
  88.           set fromRec to 1 + ((CurPage - 1) * gRowsMulti)
  89.           set toRec to fromRec + gRowsMulti - 1
  90.           if toRec > gMaxMulti then
  91.             set toRec to gMaxMulti
  92.           end if
  93.           RiempiLista()
  94.         end if
  95.         updateStage()
  96.       end if
  97.     end if
  98.   else
  99.     AlertBox("Errore DataBase Ricettario")
  100.   end if
  101. end
  102.  
  103. on NextPreviousPage direzione
  104.   global gTable, gMaxMulti, gCurrMulti, interlineaLista, gRowsMulti, CurPage, VARListaRicette, VARListaEditabili, VARListaPreferite
  105.   if objectp(gTable) then
  106.     if gMaxMulti > 0 then
  107.       set CurRiga to riga(gCurrMulti)
  108.       set CurPage to PagListaOfRec(gCurrMulti)
  109.       set ok to 0
  110.       if direzione = 1 then
  111.         set NewgCurrMulti to 1 + (CurPage * gRowsMulti)
  112.       else
  113.         set NewgCurrMulti to 1 + ((CurPage - 2) * gRowsMulti)
  114.       end if
  115.       if (NewgCurrMulti > 0) and (NewgCurrMulti <= gMaxMulti) then
  116.         mGo(gTable, NewgCurrMulti)
  117.         set gCurrMulti to mGetPosition(gTable)
  118.         put gCurrMulti into field "fgCurrMulti"
  119.         set the locV of sprite 27 to PosizioneRiga(gCurrMulti)
  120.         set CurPage to PagListaOfRec(gCurrMulti)
  121.         set fromRec to 1 + ((CurPage - 1) * gRowsMulti)
  122.         set toRec to fromRec + gRowsMulti - 1
  123.         if toRec > gMaxMulti then
  124.           set toRec to gMaxMulti
  125.         end if
  126.         RiempiLista()
  127.       else
  128.         FirstLast(direzione)
  129.       end if
  130.       ImpostaThumb()
  131.     end if
  132.   else
  133.     put "Apri il database prima!"
  134.   end if
  135. end
  136.  
  137. on RiempiLista
  138.   global gTable, gMaxMulti, gCurrMulti, RecTotal, CurPage, gRowsMulti, ListaCompleta
  139.   set ListaCompleta to 0
  140.   if gMaxMulti > 0 then
  141.     set CurPage to PagListaOfRec(gCurrMulti)
  142.     set fromRec to 1 + ((CurPage - 1) * gRowsMulti)
  143.     set toRec to gRowsMulti
  144.     if (fromRec + toRec - 1) > gMaxMulti then
  145.       set toRec to gMaxMulti - fromRec + 1
  146.     end if
  147.     put mGetSelection(gTable, "Literal", fromRec, toRec, " ", RETURN, "IsRead", "Titolo") into field "fLstTitoli"
  148.     mGo(gTable, gCurrMulti)
  149.     ImpostaControls()
  150.   else
  151.     set gCurrMulti to 0
  152.     set CurPage to 0
  153.     put EMPTY into field "fLstTitoli"
  154.     set the locV of sprite 27 to -1000
  155.   end if
  156. end
  157.  
  158. on SelezionaRecord
  159.   global gTable, gMaxMulti, gCurrMulti, CurPage, gRowsMulti
  160.   set NewgCurrMulti to the mouseLine + ((CurPage - 1) * gRowsMulti)
  161.   if (NewgCurrMulti <= gMaxMulti) and (gMaxMulti > 0) then
  162.     set gCurrMulti to NewgCurrMulti
  163.     mGo(gTable, gCurrMulti)
  164.     ImpostaControls()
  165.   end if
  166. end
  167.  
  168. on ImpostaControls
  169.   global gCurrMulti, gMaxMulti, LastRigaGlossClick
  170.   if gCurrMulti < 2 then
  171.     set the locV of sprite 27 to the top of sprite 31
  172.   else
  173.     if gCurrMulti = gMaxMulti then
  174.       set the locV of sprite 27 to the bottom of sprite 31
  175.     end if
  176.   end if
  177.   updateStage()
  178. end
  179.  
  180. on ImpostaThumb
  181.   global gCurrMulti, gMaxMulti
  182.   set dest to (float(the height of sprite 31) / float(gMaxMulti - 1) * float(gCurrMulti - 1)) + the top of sprite 31
  183.   set the locV of sprite 27 to dest
  184.   updateStage()
  185. end
  186.